package com.hw.rediscache.controller;

import com.hw.rediscache.service.RedisCacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: spring-data-redis
 * @description:
 * @author: hewei
 * @date: 2021-10-28 14:26
 **/
@RestController
public class CacheController {

    @Autowired
    private RedisCacheService cacheService;

    @GetMapping("/getNames")
    public List<String> getNames(String name){
        return cacheService.getInfoList(name);
    }
    @PostMapping("/addName")
    public void addName(String name){
        cacheService.addName(name);
    }
}
